← Back
Editing: index337.js
import{_ as e}from"./index93.js?v=1765440387";import{s as a,j as t,r as l,c as s,g as o,a5 as r,q as n,v as u,e as d,A as p,y as i,x as c,P as m,M as b,C as _,B as v,H as y,I as f,b7 as h,D as g}from"./base-lib.js?v=1765440387";import{_ as w}from"./index113.js?v=1765440387";import{im as D,io as x,M as C,R as M,ip as j,u as T,v as N,fj as V,iq as q,ir as I,$ as R,e as k}from"./utils-lib.js?v=1765440387";import{u as O}from"./useController10.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";const Y=t("CLB-LOG-STORE",()=>{const e=l("today"),a=l(""),t=l("");return{currentTab:e,logCustomDate:a,dateTabs:l([{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"自定义时间",value:"custom"}]),currentDate:t}}),A=()=>a(Y()),{activeTabs:B}=O(),{logCustomDate:H,currentDate:J}=A(),P=async e=>{const a="http"===B.value?await D({load_id:e.load_id,date:J.value}):await x({load_id:e.load_id,date:J.value});a.status?window.open("/download?filename="+a.data.filename):C.error("导出失败")},U=e=>{let a="";return"today"===e&&(a=M(new Date,"yyyy-MM-dd")),"yesterday"===e&&(a=M(j(-1),"yyyy-MM-dd")),"custom"===e&&(a=null==H?void 0:H.value),J.value=a,a};function E(e){const a=e.match(/^(\d{2})\/(\w{3})\/(\d{4}):(\d{2}):(\d{2}):(\d{2})/);if(!a)return e;const[,t,l,s,o,r,n]=a,u={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[l];return"".concat(s,"-").concat(u,"-").concat(t," ").concat(o,":").concat(r,":").concat(n)}const L={class:"p-[2rem] node-clb-http-log"},S={class:"flex items-center"},F=k(s({__name:"index",props:{compData:{default:()=>({row:{load_id:0}})}},setup(a){const{mainHeight:t}=T(),{activeTabs:s}=O(),{currentTab:D,logCustomDate:x,dateTabs:C,currentDate:M}=A(),j=a,k=o(()=>j.compData.row);let Y=l(-1);const B=e=>{D.value=e,Y.value=-1,"custom"!==e&&(x.value="",J())},H=e=>{Y.value=-1,e&&(x.value=e,J())},J=()=>{z()},F=e=>{"first"===e?(Y.value=-1,z()):"next"===e&&z()},G=l("tcpudp"===s.value?[{label:"时间",prop:"time_local",width:180,render:e=>E(e.time_local)},{label:"客户端IP",prop:"remote_addr"},{label:"协议",prop:"protocol"},{label:"响应状态",prop:"status"},{label:"发送大小",prop:"bytes_sent",render:e=>N(Number(e.bytes_sent))},{label:"接收大小",prop:"bytes_received",render:e=>N(Number(e.bytes_received))},{label:"会话耗时(秒)",prop:"session_time",render:e=>"".concat(e.session_time)},{label:"节点地址",prop:"upstream_addr",width:120},{label:"TO大小",prop:"upstream_bytes_sent",render:e=>N(Number(e.upstream_bytes_sent))},{label:"RE大小",prop:"upstream_bytes_received",render:e=>N(Number(e.upstream_bytes_received))},{label:"连接耗时(秒)",prop:"upstream_connect_time",render:e=>"".concat(e.upstream_connect_time)}]:[{label:"时间",prop:"time",render:e=>E(e.time)},{label:"客户端IP",prop:"remote_addr"},{label:"请求类型",prop:"request_method",width:80},{label:"负载节点",prop:"upstream_addr"},{label:"回源耗时(秒)",prop:"upstream_response_time"},{label:"主体大小",prop:"body_bytes_sent",render:e=>N(Number(e.body_bytes_sent))},{label:"传输大小",prop:"bytes_sent",render:e=>N(Number(e.bytes_sent))},{label:"响应状态",prop:"status"},{label:"URI",prop:"request_uri"}]),{BtTable:$,refresh:z}=V({request:async e=>{const a={load_id:k.value.load_id,date:U(D.value),position:Y.value,limit:10},{data:t}="tcpudp"===s.value?await q(a):await I(a);return Y.value=t.data.last_position,{data:t.data.logs||[],total:0,other:{}}},columns:G.value});return r(()=>{x.value="",M.value="",D.value="today"}),(a,l)=>{const s=R,o=h,r=w,M=g,j=e;return n(),u("div",L,[d(j,null,{"header-left":p(()=>[i("div",S,[i("div",null,[d(s,{type:"button",modelValue:c(D),"onUpdate:modelValue":l[0]||(l[0]=e=>m(D)?D.value=e:null),options:c(C),onChange:B,class:"mr-[1rem] !flex-nowrap"},null,8,["modelValue","options"])]),"custom"===c(D)?(n(),b(o,{key:0,modelValue:c(x),"onUpdate:modelValue":l[1]||(l[1]=e=>m(x)?x.value=e:null),type:"date",placeholder:"请选择日期","value-format":"YYYY-MM-DD",onChange:H,class:"ml-2"},null,8,["modelValue"])):_("",!0)])]),"header-right":p(()=>[d(r,{class:"ml-[10px]",onRefresh:l[2]||(l[2]=e=>F("first"))}),d(M,{type:"success",onClick:l[3]||(l[3]=e=>c(P)(c(k)))},{default:p(()=>[...l[6]||(l[6]=[i("i",{class:"el-icon-download"},null,-1),v(" 导出日志 ",-1)])]),_:1})]),content:p(()=>[d(c($),{"min-height":c(t)},null,8,["min-height"])]),"footer-right":p(()=>[d(M,{type:"info",text:"",bg:"",onClick:l[4]||(l[4]=e=>F("first"))},{default:p(()=>[...l[7]||(l[7]=[v("首页",-1)])]),_:1}),y(d(M,{type:"info",text:"",bg:"",onClick:l[5]||(l[5]=e=>F("next"))},{default:p(()=>[...l[8]||(l[8]=[v("下一页",-1)])]),_:1},512),[[f,c(Y)>0]])]),_:1})])}}}),[["__scopeId","data-v-45b8f635"]]);export{F as default};
Save File
Cancel